/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'central';
  
  checkConfig(config);
  @endpoint = getEndpoint('foasconsole', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model ConvertHybridInstanceRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='sc_flinkserverless_public_cn-7e22ae5sess'),
  region?: string(name='Region', description='This parameter is required.', example='cn-shenzhen'),
  resourceSpec?: {
    cpu?: int32(name='Cpu', description='This parameter is required.', example='10'),
    memoryGB?: int32(name='MemoryGB', description='This parameter is required.', example='40GB'),
  }(name='ResourceSpec', description='This parameter is required.'),
}

model ConvertHybridInstanceShrinkRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='sc_flinkserverless_public_cn-7e22ae5sess'),
  region?: string(name='Region', description='This parameter is required.', example='cn-shenzhen'),
  resourceSpecShrink?: string(name='ResourceSpec', description='This parameter is required.'),
}

model ConvertHybridInstanceResponseBody = {
  errCode?: string(name='ErrCode', example='000000'),
  orderInfo?: {
    elasticInstanceId?: string(name='ElasticInstanceId'),
    instanceId?: string(name='InstanceId', example='f-cn-zvp2q0zik06'),
    orderId?: long(name='OrderId', example='210406354694567'),
  }(name='OrderInfo'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model ConvertHybridInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ConvertHybridInstanceResponseBody(name='body'),
}

/**
 * @summary 开通弹性计算
 *
 * @param tmpReq ConvertHybridInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ConvertHybridInstanceResponse
 */
async function convertHybridInstanceWithOptions(tmpReq: ConvertHybridInstanceRequest, runtime: Util.RuntimeOptions): ConvertHybridInstanceResponse {
  Util.validateModel(tmpReq);
  var request = new ConvertHybridInstanceShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.resourceSpec)) {
    request.resourceSpecShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.resourceSpec, 'ResourceSpec', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceSpecShrink)) {
    query['ResourceSpec'] = request.resourceSpecShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ConvertHybridInstance',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 开通弹性计算
 *
 * @param request ConvertHybridInstanceRequest
 * @return ConvertHybridInstanceResponse
 */
async function convertHybridInstance(request: ConvertHybridInstanceRequest): ConvertHybridInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return convertHybridInstanceWithOptions(request, runtime);
}

model ConvertInstanceRequest {
  duration?: int32(name='Duration', description='This parameter is required.', example='1'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  isAutoRenew?: boolean(name='IsAutoRenew', description='This parameter is required.', example='true'),
  namespaceResourceSpecs?: [ 
    {
      namespace?: string(name='Namespace', description='This parameter is required.', example='ns-1'),
      resourceSpec?: {
        cpu?: int32(name='Cpu', description='This parameter is required.', example='1'),
        memoryGB?: int32(name='MemoryGB', description='This parameter is required.', example='4'),
      }(name='ResourceSpec', description='This parameter is required.'),
    }
  ](name='NamespaceResourceSpecs', description='This parameter is required.'),
  pricingCycle?: string(name='PricingCycle', description='This parameter is required.', example='Month'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
}

model ConvertInstanceShrinkRequest {
  duration?: int32(name='Duration', description='This parameter is required.', example='1'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  isAutoRenew?: boolean(name='IsAutoRenew', description='This parameter is required.', example='true'),
  namespaceResourceSpecsShrink?: string(name='NamespaceResourceSpecs', description='This parameter is required.'),
  pricingCycle?: string(name='PricingCycle', description='This parameter is required.', example='Month'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
}

model ConvertInstanceResponseBody = {
  orderId?: long(name='OrderId', example='211473228320700'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model ConvertInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ConvertInstanceResponseBody(name='body'),
}

/**
 * @summary 按量付费转包年包月
 *
 * @param tmpReq ConvertInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ConvertInstanceResponse
 */
async function convertInstanceWithOptions(tmpReq: ConvertInstanceRequest, runtime: Util.RuntimeOptions): ConvertInstanceResponse {
  Util.validateModel(tmpReq);
  var request = new ConvertInstanceShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.namespaceResourceSpecs)) {
    request.namespaceResourceSpecsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.namespaceResourceSpecs, 'NamespaceResourceSpecs', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.duration)) {
    body['Duration'] = request.duration;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.isAutoRenew)) {
    body['IsAutoRenew'] = request.isAutoRenew;
  }
  if (!Util.isUnset(request.namespaceResourceSpecsShrink)) {
    body['NamespaceResourceSpecs'] = request.namespaceResourceSpecsShrink;
  }
  if (!Util.isUnset(request.pricingCycle)) {
    body['PricingCycle'] = request.pricingCycle;
  }
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ConvertInstance',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 按量付费转包年包月
 *
 * @param request ConvertInstanceRequest
 * @return ConvertInstanceResponse
 */
async function convertInstance(request: ConvertInstanceRequest): ConvertInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return convertInstanceWithOptions(request, runtime);
}

model ConvertPrepayInstanceRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
}

model ConvertPrepayInstanceResponseBody = {
  orderId?: long(name='OrderId', example='210406354690749'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model ConvertPrepayInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ConvertPrepayInstanceResponseBody(name='body'),
}

/**
 * @summary 包年包月转按量付费
 *
 * @param request ConvertPrepayInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ConvertPrepayInstanceResponse
 */
async function convertPrepayInstanceWithOptions(request: ConvertPrepayInstanceRequest, runtime: Util.RuntimeOptions): ConvertPrepayInstanceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ConvertPrepayInstance',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 包年包月转按量付费
 *
 * @param request ConvertPrepayInstanceRequest
 * @return ConvertPrepayInstanceResponse
 */
async function convertPrepayInstance(request: ConvertPrepayInstanceRequest): ConvertPrepayInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return convertPrepayInstanceWithOptions(request, runtime);
}

model CreateInstanceRequest {
  architectureType?: string(name='ArchitectureType'),
  autoRenew?: boolean(name='AutoRenew', example='true'),
  chargeType?: string(name='ChargeType', description='This parameter is required.', example='PRE'),
  duration?: int32(name='Duration', example='1'),
  extra?: string(name='Extra'),
  ha?: boolean(name='Ha', nullable=true),
  haResourceSpec?: {
    cpu?: int32(name='Cpu'),
    memoryGB?: int32(name='MemoryGB'),
  }(name='HaResourceSpec', nullable=true),
  haVSwitchIds?: [ string ](name='HaVSwitchIds', nullable=true),
  instanceName?: string(name='InstanceName', description='This parameter is required.', example='rtc-e2e-test-pre'),
  monitorType?: string(name='MonitorType'),
  pricingCycle?: string(name='PricingCycle', example='Month'),
  promotionCode?: string(name='PromotionCode', example='500043499350689'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
  resourceGroupId?: string(name='ResourceGroupId'),
  resourceSpec?: {
    cpu?: int32(name='Cpu', example='30'),
    memoryGB?: int32(name='MemoryGB', example='120'),
  }(name='ResourceSpec'),
  storage?: {
    fullyManaged?: boolean(name='FullyManaged'),
    oss?: {
      bucket?: string(name='Bucket', example='oss-flink-cn-shanghai-260343971602724445'),
    }(name='Oss'),
  }(name='Storage', description='This parameter is required.'),
  tag?: [ 
    {
      key?: string(name='Key'),
      value?: string(name='Value'),
    }
  ](name='Tag'),
  usePromotionCode?: boolean(name='UsePromotionCode'),
  vSwitchIds?: [ string ](name='VSwitchIds', description='This parameter is required.'),
  vpcId?: string(name='VpcId', description='This parameter is required.', example='vpc-2ze9xoh8qyt1rnxfmfcdi'),
}

model CreateInstanceShrinkRequest {
  architectureType?: string(name='ArchitectureType'),
  autoRenew?: boolean(name='AutoRenew', example='true'),
  chargeType?: string(name='ChargeType', description='This parameter is required.', example='PRE'),
  duration?: int32(name='Duration', example='1'),
  extra?: string(name='Extra'),
  ha?: boolean(name='Ha', nullable=true),
  haResourceSpecShrink?: string(name='HaResourceSpec', nullable=true),
  haVSwitchIdsShrink?: string(name='HaVSwitchIds', nullable=true),
  instanceName?: string(name='InstanceName', description='This parameter is required.', example='rtc-e2e-test-pre'),
  monitorType?: string(name='MonitorType'),
  pricingCycle?: string(name='PricingCycle', example='Month'),
  promotionCode?: string(name='PromotionCode', example='500043499350689'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
  resourceGroupId?: string(name='ResourceGroupId'),
  resourceSpecShrink?: string(name='ResourceSpec'),
  storageShrink?: string(name='Storage', description='This parameter is required.'),
  tagShrink?: string(name='Tag'),
  usePromotionCode?: boolean(name='UsePromotionCode'),
  vSwitchIdsShrink?: string(name='VSwitchIds', description='This parameter is required.'),
  vpcId?: string(name='VpcId', description='This parameter is required.', example='vpc-2ze9xoh8qyt1rnxfmfcdi'),
}

model CreateInstanceResponseBody = {
  orderInfo?: {
    instanceId?: string(name='InstanceId', example='f-cn-zvp2q0zik06'),
    orderId?: long(name='OrderId', example='210406354694567'),
    storageInstanceId?: string(name='StorageInstanceId'),
    storageOrderId?: long(name='StorageOrderId'),
  }(name='OrderInfo'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model CreateInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateInstanceResponseBody(name='body'),
}

/**
 * @summary 创建实例
 *
 * @param tmpReq CreateInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateInstanceResponse
 */
async function createInstanceWithOptions(tmpReq: CreateInstanceRequest, runtime: Util.RuntimeOptions): CreateInstanceResponse {
  Util.validateModel(tmpReq);
  var request = new CreateInstanceShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.haResourceSpec)) {
    request.haResourceSpecShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.haResourceSpec, 'HaResourceSpec', 'json');
  }
  if (!Util.isUnset(tmpReq.haVSwitchIds)) {
    request.haVSwitchIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.haVSwitchIds, 'HaVSwitchIds', 'json');
  }
  if (!Util.isUnset(tmpReq.resourceSpec)) {
    request.resourceSpecShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.resourceSpec, 'ResourceSpec', 'json');
  }
  if (!Util.isUnset(tmpReq.storage)) {
    request.storageShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.storage, 'Storage', 'json');
  }
  if (!Util.isUnset(tmpReq.tag)) {
    request.tagShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.tag, 'Tag', 'json');
  }
  if (!Util.isUnset(tmpReq.vSwitchIds)) {
    request.vSwitchIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.vSwitchIds, 'VSwitchIds', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.architectureType)) {
    body['ArchitectureType'] = request.architectureType;
  }
  if (!Util.isUnset(request.autoRenew)) {
    body['AutoRenew'] = request.autoRenew;
  }
  if (!Util.isUnset(request.chargeType)) {
    body['ChargeType'] = request.chargeType;
  }
  if (!Util.isUnset(request.duration)) {
    body['Duration'] = request.duration;
  }
  if (!Util.isUnset(request.extra)) {
    body['Extra'] = request.extra;
  }
  if (!Util.isUnset(request.ha)) {
    body['Ha'] = request.ha;
  }
  if (!Util.isUnset(request.haResourceSpecShrink)) {
    body['HaResourceSpec'] = request.haResourceSpecShrink;
  }
  if (!Util.isUnset(request.haVSwitchIdsShrink)) {
    body['HaVSwitchIds'] = request.haVSwitchIdsShrink;
  }
  if (!Util.isUnset(request.instanceName)) {
    body['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.monitorType)) {
    body['MonitorType'] = request.monitorType;
  }
  if (!Util.isUnset(request.pricingCycle)) {
    body['PricingCycle'] = request.pricingCycle;
  }
  if (!Util.isUnset(request.promotionCode)) {
    body['PromotionCode'] = request.promotionCode;
  }
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceSpecShrink)) {
    body['ResourceSpec'] = request.resourceSpecShrink;
  }
  if (!Util.isUnset(request.storageShrink)) {
    body['Storage'] = request.storageShrink;
  }
  if (!Util.isUnset(request.tagShrink)) {
    body['Tag'] = request.tagShrink;
  }
  if (!Util.isUnset(request.usePromotionCode)) {
    body['UsePromotionCode'] = request.usePromotionCode;
  }
  if (!Util.isUnset(request.vSwitchIdsShrink)) {
    body['VSwitchIds'] = request.vSwitchIdsShrink;
  }
  if (!Util.isUnset(request.vpcId)) {
    body['VpcId'] = request.vpcId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateInstance',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建实例
 *
 * @param request CreateInstanceRequest
 * @return CreateInstanceResponse
 */
async function createInstance(request: CreateInstanceRequest): CreateInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createInstanceWithOptions(request, runtime);
}

model CreateNamespaceRequest {
  ha?: boolean(name='Ha', nullable=true),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  namespace?: string(name='Namespace', description='This parameter is required.', example='di-593440390152545'),
  region?: string(name='Region', description='This parameter is required.', example='cn-shenzhen'),
  resourceSpec?: {
    cpu?: int32(name='Cpu', example='30'),
    memoryGB?: int32(name='MemoryGB', example='120'),
  }(name='ResourceSpec'),
}

model CreateNamespaceShrinkRequest {
  ha?: boolean(name='Ha', nullable=true),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  namespace?: string(name='Namespace', description='This parameter is required.', example='di-593440390152545'),
  region?: string(name='Region', description='This parameter is required.', example='cn-shenzhen'),
  resourceSpecShrink?: string(name='ResourceSpec'),
}

model CreateNamespaceResponseBody = {
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='是否成功'),
}

model CreateNamespaceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateNamespaceResponseBody(name='body'),
}

/**
 * @summary 创建命名空间
 *
 * @param tmpReq CreateNamespaceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateNamespaceResponse
 */
async function createNamespaceWithOptions(tmpReq: CreateNamespaceRequest, runtime: Util.RuntimeOptions): CreateNamespaceResponse {
  Util.validateModel(tmpReq);
  var request = new CreateNamespaceShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.resourceSpec)) {
    request.resourceSpecShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.resourceSpec, 'ResourceSpec', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.ha)) {
    body['Ha'] = request.ha;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.namespace)) {
    body['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceSpecShrink)) {
    body['ResourceSpec'] = request.resourceSpecShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateNamespace',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建命名空间
 *
 * @param request CreateNamespaceRequest
 * @return CreateNamespaceResponse
 */
async function createNamespace(request: CreateNamespaceRequest): CreateNamespaceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createNamespaceWithOptions(request, runtime);
}

model DeleteInstanceRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
}

model DeleteInstanceResponseBody = {
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='True'),
}

model DeleteInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteInstanceResponseBody(name='body'),
}

/**
 * @summary 释放按量付费的实例
 *
 * @param request DeleteInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteInstanceResponse
 */
async function deleteInstanceWithOptions(request: DeleteInstanceRequest, runtime: Util.RuntimeOptions): DeleteInstanceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteInstance',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 释放按量付费的实例
 *
 * @param request DeleteInstanceRequest
 * @return DeleteInstanceResponse
 */
async function deleteInstance(request: DeleteInstanceRequest): DeleteInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteInstanceWithOptions(request, runtime);
}

model DeleteNamespaceRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  namespace?: string(name='Namespace', description='This parameter is required.', example='di-593439443804417'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
}

model DeleteNamespaceResponseBody = {
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='是否成功'),
}

model DeleteNamespaceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteNamespaceResponseBody(name='body'),
}

/**
 * @summary 删除namespace
 *
 * @param request DeleteNamespaceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteNamespaceResponse
 */
async function deleteNamespaceWithOptions(request: DeleteNamespaceRequest, runtime: Util.RuntimeOptions): DeleteNamespaceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.namespace)) {
    body['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteNamespace',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除namespace
 *
 * @param request DeleteNamespaceRequest
 * @return DeleteNamespaceResponse
 */
async function deleteNamespace(request: DeleteNamespaceRequest): DeleteNamespaceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteNamespaceWithOptions(request, runtime);
}

model DescribeInstancesRequest {
  architectureType?: string(name='ArchitectureType'),
  chargeType?: string(name='ChargeType', example='PRE'),
  instanceId?: string(name='InstanceId', example='f-cn-wwo36qj4g06'),
  pageIndex?: int32(name='PageIndex', example='2'),
  pageSize?: int32(name='PageSize', example='10'),
  region?: string(name='Region', description='This parameter is required.', example='cn-shenzhen'),
  resourceGroupId?: string(name='ResourceGroupId'),
  tags?: [ 
    {
      key?: string(name='Key', example='test'),
      value?: string(name='Value', example='ys'),
    }
  ](name='Tags'),
}

model DescribeInstancesShrinkRequest {
  architectureType?: string(name='ArchitectureType'),
  chargeType?: string(name='ChargeType', example='PRE'),
  instanceId?: string(name='InstanceId', example='f-cn-wwo36qj4g06'),
  pageIndex?: int32(name='PageIndex', example='2'),
  pageSize?: int32(name='PageSize', example='10'),
  region?: string(name='Region', description='This parameter is required.', example='cn-shenzhen'),
  resourceGroupId?: string(name='ResourceGroupId'),
  tagsShrink?: string(name='Tags'),
}

model DescribeInstancesResponseBody = {
  instances?: [ 
    {
      ansm?: boolean(name='Ansm'),
      architectureType?: string(name='ArchitectureType'),
      askClusterId?: string(name='AskClusterId'),
      chargeType?: string(name='ChargeType', example='PRE'),
      clusterState?: {
        clusterId?: string(name='ClusterId'),
        clusterStage?: {
          clusterId?: string(name='ClusterId'),
          currentStage?: int32(name='CurrentStage'),
          message?: string(name='Message'),
          status?: string(name='Status'),
          totalStageWithWeight?: [ 
            {
              stepIndex?: int32(name='StepIndex'),
              stepName?: string(name='StepName'),
              weight?: int32(name='Weight'),
            }
          ](name='TotalStageWithWeight'),
        }(name='ClusterStage'),
        createTimeout?: boolean(name='CreateTimeout'),
        status?: string(name='Status'),
        subStatus?: string(name='SubStatus'),
        url?: string(name='Url'),
        userSlbDto?: {
          existSlb?: boolean(name='ExistSlb'),
          slbId?: string(name='SlbId'),
          slbIp?: string(name='SlbIp'),
          slbStatus?: string(name='SlbStatus'),
          userSlbListeners?: [ 
            {
              listenersStatus?: string(name='ListenersStatus'),
              port?: string(name='Port'),
            }
          ](name='UserSlbListeners'),
        }(name='UserSlbDto'),
        vpcCidr?: string(name='VpcCidr'),
      }(name='ClusterState'),
      clusterStatus?: string(name='ClusterStatus', example='RUNNING'),
      clusterUsedResources?: {
        clusterId?: string(name='ClusterId'),
        elasticUsedCpu?: float(name='ElasticUsedCpu'),
        elasticUsedMemory?: float(name='ElasticUsedMemory'),
        elasticUsedResource?: float(name='ElasticUsedResource'),
        guaranteedUsedCpu?: float(name='GuaranteedUsedCpu'),
        guaranteedUsedMemory?: float(name='GuaranteedUsedMemory'),
        guaranteedUsedResource?: float(name='GuaranteedUsedResource'),
        ha?: boolean(name='Ha'),
        haUsedCpu?: float(name='HaUsedCpu'),
        haUsedMemory?: float(name='HaUsedMemory'),
        haUsedResource?: float(name='HaUsedResource'),
        usedCpu?: float(name='UsedCpu'),
        usedMemory?: float(name='UsedMemory'),
        usedResource?: float(name='UsedResource'),
      }(name='ClusterUsedResources'),
      clusterUsedStorage?: {
        clusterId?: string(name='ClusterId'),
        usedStorage?: float(name='UsedStorage'),
      }(name='ClusterUsedStorage'),
      elastic?: boolean(name='Elastic'),
      elasticOrderState?: string(name='ElasticOrderState'),
      elasticResourceSpec?: {
        cpu?: int32(name='Cpu'),
        memoryGB?: int32(name='MemoryGB'),
      }(name='ElasticResourceSpec'),
      ha?: boolean(name='Ha'),
      haResourceSpec?: {
        cpu?: int32(name='Cpu'),
        memoryGB?: int32(name='MemoryGB'),
      }(name='HaResourceSpec'),
      haVSwitchIds?: [ string ](name='HaVSwitchIds'),
      haVSwitchInfo?: [ 
        {
          availableIpAddressCount?: long(name='AvailableIpAddressCount'),
          description?: string(name='Description'),
          regionId?: string(name='RegionId'),
          vSwitchCidr?: string(name='VSwitchCidr'),
          vSwitchId?: string(name='VSwitchId'),
          vSwitchName?: string(name='VSwitchName'),
          vpcId?: string(name='VpcId'),
          zoneId?: string(name='ZoneId'),
        }
      ](name='HaVSwitchInfo'),
      haZoneId?: string(name='HaZoneId'),
      hostAliases?: [ 
        {
          hostNames?: [ string ](name='HostNames', description='This parameter is required.'),
          ip?: string(name='Ip', description='This parameter is required.'),
        }
      ](name='HostAliases', description='This parameter is required.'),
      instanceId?: string(name='InstanceId', example='f-cn-zvp2q0zik06'),
      instanceName?: string(name='InstanceName', example='vvp1'),
      monitorType?: string(name='MonitorType'),
      orderState?: string(name='OrderState', example='NORMAL'),
      ossInfo?: {
        accessId?: string(name='AccessId'),
        accessKey?: string(name='AccessKey'),
        bucket?: string(name='Bucket'),
        bucketVersioningStatus?: string(name='BucketVersioningStatus'),
        endpoint?: string(name='Endpoint'),
      }(name='OssInfo'),
      region?: string(name='Region', example='cn-beijing'),
      resourceCreateTime?: long(name='ResourceCreateTime', example='1629879567394'),
      resourceExpiredTime?: long(name='ResourceExpiredTime', example='1637337600000'),
      resourceGroupId?: string(name='ResourceGroupId'),
      resourceId?: string(name='ResourceId', example='b3690a1655da47'),
      resourceSpec?: {
        cpu?: int32(name='Cpu', example='10'),
        memoryGB?: int32(name='MemoryGB', example='40'),
      }(name='ResourceSpec'),
      storage?: {
        fullyManaged?: boolean(name='FullyManaged'),
        orderState?: string(name='OrderState'),
        oss?: {
          bucket?: string(name='Bucket', example='oss_flink'),
        }(name='Oss'),
        supportCreateFullyManagedStorage?: boolean(name='SupportCreateFullyManagedStorage'),
        supportMigrationProgressDetection?: boolean(name='SupportMigrationProgressDetection'),
      }(name='Storage'),
      tags?: [ 
        {
          key?: string(name='Key', example='flink'),
          value?: string(name='Value', example='test'),
        }
      ](name='Tags'),
      uid?: string(name='Uid', example='1838996687368452'),
      vSwitchIds?: [ string ](name='VSwitchIds'),
      vSwitchInfo?: [ 
        {
          availableIpAddressCount?: string(name='AvailableIpAddressCount'),
          description?: string(name='Description'),
          regionId?: string(name='RegionId'),
          vSwitchCidr?: string(name='VSwitchCidr'),
          vSwitchId?: string(name='VSwitchId'),
          vSwitchName?: string(name='VSwitchName'),
          vpcId?: string(name='VpcId'),
          zoneId?: string(name='ZoneId'),
        }
      ](name='VSwitchInfo'),
      vpcId?: string(name='VpcId', example='vpc-2ze9*******nxfmfcdi'),
      vpcInfo?: {
        cidrBlock?: string(name='CidrBlock'),
        description?: string(name='Description'),
        regionId?: string(name='RegionId'),
        status?: string(name='Status'),
        vpcId?: string(name='VpcId'),
        vpcName?: string(name='VpcName'),
      }(name='VpcInfo'),
      zoneId?: string(name='ZoneId', example='cn-beijing-g'),
    }
  ](name='Instances'),
  pageIndex?: int32(name='PageIndex', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  requestId?: string(name='RequestId', example='C8DF2A5B-6FBA-5651-A3D4-960F36640E6B'),
  success?: boolean(name='Success', example='true'),
  totalCount?: long(name='TotalCount', example='15'),
  totalPage?: int32(name='TotalPage', example='2'),
}

model DescribeInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeInstancesResponseBody(name='body'),
}

/**
 * @summary instance列表
 *
 * @param tmpReq DescribeInstancesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeInstancesResponse
 */
async function describeInstancesWithOptions(tmpReq: DescribeInstancesRequest, runtime: Util.RuntimeOptions): DescribeInstancesResponse {
  Util.validateModel(tmpReq);
  var request = new DescribeInstancesShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.tags)) {
    request.tagsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.tags, 'Tags', 'json');
  }
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeInstances',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary instance列表
 *
 * @param request DescribeInstancesRequest
 * @return DescribeInstancesResponse
 */
async function describeInstances(request: DescribeInstancesRequest): DescribeInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInstancesWithOptions(request, runtime);
}

model DescribeNamespacesRequest {
  ha?: boolean(name='Ha', nullable=true),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  namespace?: string(name='Namespace', example='di-590843445844225'),
  pageIndex?: int32(name='PageIndex', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
  tags?: [ 
    {
      key?: string(name='Key', example='FLink'),
      value?: string(name='Value', example='test'),
    }
  ](name='Tags'),
}

model DescribeNamespacesShrinkRequest {
  ha?: boolean(name='Ha', nullable=true),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  namespace?: string(name='Namespace', example='di-590843445844225'),
  pageIndex?: int32(name='PageIndex', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
  tagsShrink?: string(name='Tags'),
}

model DescribeNamespacesResponseBody = {
  namespaces?: [ 
    {
      elasticResourceSpec?: {
        cpu?: int32(name='Cpu'),
        memoryGB?: int32(name='MemoryGB'),
      }(name='ElasticResourceSpec'),
      gmtCreate?: long(name='GmtCreate', example='1629879567394'),
      gmtModified?: long(name='GmtModified', example='1629879567394'),
      guaranteedResourceSpec?: {
        cpu?: int32(name='Cpu'),
        memoryGB?: int32(name='MemoryGB'),
      }(name='GuaranteedResourceSpec'),
      ha?: boolean(name='Ha'),
      namespace?: string(name='Namespace', example='ns-1'),
      resourceSpec?: {
        cpu?: int32(name='Cpu', example='10'),
        memoryGB?: int32(name='MemoryGB', example='40'),
      }(name='ResourceSpec'),
      resourceUsed?: {
        cpu?: float(name='Cpu', example='2'),
        cu?: float(name='Cu'),
        memoryGB?: float(name='MemoryGB', example='4'),
      }(name='ResourceUsed'),
      status?: string(name='Status', example='SUCCESS'),
      tags?: [ 
        {
          key?: string(name='Key', example='flink'),
          value?: string(name='Value', example='test'),
        }
      ](name='Tags'),
    }
  ](name='Namespaces'),
  pageIndex?: int32(name='PageIndex', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
  totalCount?: long(name='TotalCount', example='5'),
  totalPage?: int32(name='TotalPage', example='2'),
}

model DescribeNamespacesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeNamespacesResponseBody(name='body'),
}

/**
 * @summary namespace列表
 *
 * @param tmpReq DescribeNamespacesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeNamespacesResponse
 */
async function describeNamespacesWithOptions(tmpReq: DescribeNamespacesRequest, runtime: Util.RuntimeOptions): DescribeNamespacesResponse {
  Util.validateModel(tmpReq);
  var request = new DescribeNamespacesShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.tags)) {
    request.tagsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.tags, 'Tags', 'json');
  }
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeNamespaces',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary namespace列表
 *
 * @param request DescribeNamespacesRequest
 * @return DescribeNamespacesResponse
 */
async function describeNamespaces(request: DescribeNamespacesRequest): DescribeNamespacesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeNamespacesWithOptions(request, runtime);
}

model DescribeSupportedRegionsResponseBody = {
  pageIndex?: int32(name='PageIndex', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  regions?: [ 
    {
      description?: string(name='Description'),
      extra?: string(name='Extra'),
      region?: string(name='Region', example='cn-beijing'),
      regionName?: string(name='RegionName', example='华北2 (北京)'),
    }
  ](name='Regions'),
  requestId?: string(name='RequestId', example='B21DC47E-8928-199A-9F32-36D45E4693B4'),
  success?: boolean(name='Success', example='true'),
  totalCount?: long(name='TotalCount', example='10'),
  totalPage?: int32(name='TotalPage', example='2'),
}

model DescribeSupportedRegionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSupportedRegionsResponseBody(name='body'),
}

/**
 * @summary 获取支持的region列表
 *
 * @param request DescribeSupportedRegionsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSupportedRegionsResponse
 */
async function describeSupportedRegionsWithOptions(runtime: Util.RuntimeOptions): DescribeSupportedRegionsResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'DescribeSupportedRegions',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取支持的region列表
 *
 * @return DescribeSupportedRegionsResponse
 */
async function describeSupportedRegions(): DescribeSupportedRegionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSupportedRegionsWithOptions(runtime);
}

model DescribeSupportedZonesRequest {
  architectureType?: string(name='ArchitectureType'),
  region?: string(name='Region', example='cn-beijing'),
}

model DescribeSupportedZonesResponseBody = {
  pageIndex?: int32(name='PageIndex', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  requestId?: string(name='RequestId', example='23A9C718-DDAB-1696-B025-18FBC830F7C5'),
  success?: boolean(name='Success', example='true'),
  totalCount?: long(name='TotalCount', example='8'),
  totalPage?: int32(name='TotalPage', example='1'),
  zoneIds?: [ string ](name='ZoneIds'),
}

model DescribeSupportedZonesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSupportedZonesResponseBody(name='body'),
}

/**
 * @summary 获取支持的zoneId列表
 *
 * @param request DescribeSupportedZonesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSupportedZonesResponse
 */
async function describeSupportedZonesWithOptions(request: DescribeSupportedZonesRequest, runtime: Util.RuntimeOptions): DescribeSupportedZonesResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSupportedZones',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取支持的zoneId列表
 *
 * @param request DescribeSupportedZonesRequest
 * @return DescribeSupportedZonesResponse
 */
async function describeSupportedZones(request: DescribeSupportedZonesRequest): DescribeSupportedZonesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSupportedZonesWithOptions(request, runtime);
}

model ListTagResourcesRequest {
  nextToken?: string(name='NextToken', example='27AE00'),
  regionId?: string(name='RegionId', description='This parameter is required.', example='cn-beijing'),
  resourceId?: [ string ](name='ResourceId'),
  resourceType?: string(name='ResourceType', description='This parameter is required.', example='vvpinstance'),
  tag?: [ 
    {
      key?: string(name='Key', example='test'),
      value?: string(name='Value', example='tag'),
    }
  ](name='Tag'),
}

model ListTagResourcesResponseBody = {
  nextToken?: string(name='NextToken', example='27AE00'),
  requestId?: string(name='RequestId', example='0E5D17CE-BD83-5DC9-8CD2-3C40C2F7A135'),
  success?: boolean(name='Success', example='true'),
  tagReponseId?: string(name='TagReponseId', example='87AE00'),
  tagResources?: [ 
    {
      resourceId?: string(name='ResourceId', example='f-cn-tyts'),
      resourceType?: string(name='ResourceType', example='vvpinstance'),
      tagKey?: string(name='TagKey', example='test'),
      tagValue?: string(name='TagValue', example='tag'),
    }
  ](name='TagResources'),
}

model ListTagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagResourcesResponseBody(name='body'),
}

/**
 * @summary 列举flinkasi标签
 *
 * @param request ListTagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTagResourcesResponse
 */
async function listTagResourcesWithOptions(request: ListTagResourcesRequest, runtime: Util.RuntimeOptions): ListTagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTagResources',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 列举flinkasi标签
 *
 * @param request ListTagResourcesRequest
 * @return ListTagResourcesResponse
 */
async function listTagResources(request: ListTagResourcesRequest): ListTagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTagResourcesWithOptions(request, runtime);
}

model ModifyElasticResourceSpecRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='sc_flinkserverless_public_cn-7e22ae5sess'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
  resourceSpec?: {
    cpu?: int32(name='Cpu', description='This parameter is required.', example='10'),
    memoryGB?: int32(name='MemoryGB', description='This parameter is required.', example='40'),
  }(name='ResourceSpec', description='This parameter is required.'),
}

model ModifyElasticResourceSpecShrinkRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='sc_flinkserverless_public_cn-7e22ae5sess'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
  resourceSpecShrink?: string(name='ResourceSpec', description='This parameter is required.'),
}

model ModifyElasticResourceSpecResponseBody = {
  orderId?: long(name='OrderId', example='211473228320700'),
  requestId?: string(name='RequestId', example='B21DC47E-8928-199A-9F32-36D45E4693B4'),
  success?: boolean(name='Success', example='true'),
}

model ModifyElasticResourceSpecResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyElasticResourceSpecResponseBody(name='body'),
}

/**
 * @summary 对按量弹性实例修改resource quota
 *
 * @param tmpReq ModifyElasticResourceSpecRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyElasticResourceSpecResponse
 */
async function modifyElasticResourceSpecWithOptions(tmpReq: ModifyElasticResourceSpecRequest, runtime: Util.RuntimeOptions): ModifyElasticResourceSpecResponse {
  Util.validateModel(tmpReq);
  var request = new ModifyElasticResourceSpecShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.resourceSpec)) {
    request.resourceSpecShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.resourceSpec, 'ResourceSpec', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceSpecShrink)) {
    body['ResourceSpec'] = request.resourceSpecShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifyElasticResourceSpec',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 对按量弹性实例修改resource quota
 *
 * @param request ModifyElasticResourceSpecRequest
 * @return ModifyElasticResourceSpecResponse
 */
async function modifyElasticResourceSpec(request: ModifyElasticResourceSpecRequest): ModifyElasticResourceSpecResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyElasticResourceSpecWithOptions(request, runtime);
}

model ModifyInstanceVswitchRequest {
  haVSwitchIds?: [ string ](name='HaVSwitchIds'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='sc_flinkserverless_public_cn-7e22ae****'),
  vSwitchIds?: [ string ](name='VSwitchIds'),
}

model ModifyInstanceVswitchShrinkRequest {
  haVSwitchIdsShrink?: string(name='HaVSwitchIds'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='sc_flinkserverless_public_cn-7e22ae****'),
  vSwitchIdsShrink?: string(name='VSwitchIds'),
}

model ModifyInstanceVswitchResponseBody = {
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426****'),
  result?: string(name='Result', example='F2C5B6A8-DD04-51F5-AAD5-BA2FE6FD****'),
  success?: boolean(name='Success', example='true'),
}

model ModifyInstanceVswitchResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyInstanceVswitchResponseBody(name='body'),
}

/**
 * @summary 修改集群交换机
 *
 * @param tmpReq ModifyInstanceVswitchRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyInstanceVswitchResponse
 */
async function modifyInstanceVswitchWithOptions(tmpReq: ModifyInstanceVswitchRequest, runtime: Util.RuntimeOptions): ModifyInstanceVswitchResponse {
  Util.validateModel(tmpReq);
  var request = new ModifyInstanceVswitchShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.haVSwitchIds)) {
    request.haVSwitchIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.haVSwitchIds, 'HaVSwitchIds', 'json');
  }
  if (!Util.isUnset(tmpReq.vSwitchIds)) {
    request.vSwitchIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.vSwitchIds, 'VSwitchIds', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.haVSwitchIdsShrink)) {
    body['HaVSwitchIds'] = request.haVSwitchIdsShrink;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.vSwitchIdsShrink)) {
    body['VSwitchIds'] = request.vSwitchIdsShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifyInstanceVswitch',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 修改集群交换机
 *
 * @param request ModifyInstanceVswitchRequest
 * @return ModifyInstanceVswitchResponse
 */
async function modifyInstanceVswitch(request: ModifyInstanceVswitchRequest): ModifyInstanceVswitchResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyInstanceVswitchWithOptions(request, runtime);
}

model ModifyNamespaceSpecV2Request {
  elasticResourceSpec?: {
    cpu?: int32(name='Cpu', description='This parameter is required.', example='6'),
    memoryGB?: int32(name='MemoryGB', description='This parameter is required.', example='52'),
  }(name='ElasticResourceSpec'),
  guaranteedResourceSpec?: {
    cpu?: int32(name='Cpu', description='This parameter is required.', example='10'),
    memoryGB?: int32(name='MemoryGB', description='This parameter is required.', example='40'),
  }(name='GuaranteedResourceSpec'),
  ha?: boolean(name='Ha', description='This parameter is required.', example='false'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  namespace?: string(name='Namespace', description='This parameter is required.', example='di-593439443804417'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
}

model ModifyNamespaceSpecV2ShrinkRequest {
  elasticResourceSpecShrink?: string(name='ElasticResourceSpec'),
  guaranteedResourceSpecShrink?: string(name='GuaranteedResourceSpec'),
  ha?: boolean(name='Ha', description='This parameter is required.', example='false'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  namespace?: string(name='Namespace', description='This parameter is required.', example='di-593439443804417'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
}

model ModifyNamespaceSpecV2ResponseBody = {
  requestId?: string(name='RequestId', example='23A9C718-DDAB-1696-B025-18FBC830F7C5'),
  success?: boolean(name='Success', example='true'),
}

model ModifyNamespaceSpecV2Response = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyNamespaceSpecV2ResponseBody(name='body'),
}

/**
 * @summary 修改namespace资源，包含按量和包年包月、混合计费
 *
 * @param tmpReq ModifyNamespaceSpecV2Request
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyNamespaceSpecV2Response
 */
async function modifyNamespaceSpecV2WithOptions(tmpReq: ModifyNamespaceSpecV2Request, runtime: Util.RuntimeOptions): ModifyNamespaceSpecV2Response {
  Util.validateModel(tmpReq);
  var request = new ModifyNamespaceSpecV2ShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.elasticResourceSpec)) {
    request.elasticResourceSpecShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.elasticResourceSpec, 'ElasticResourceSpec', 'json');
  }
  if (!Util.isUnset(tmpReq.guaranteedResourceSpec)) {
    request.guaranteedResourceSpecShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.guaranteedResourceSpec, 'GuaranteedResourceSpec', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.ha)) {
    query['Ha'] = request.ha;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.elasticResourceSpecShrink)) {
    body['ElasticResourceSpec'] = request.elasticResourceSpecShrink;
  }
  if (!Util.isUnset(request.guaranteedResourceSpecShrink)) {
    body['GuaranteedResourceSpec'] = request.guaranteedResourceSpecShrink;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.namespace)) {
    body['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifyNamespaceSpecV2',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 修改namespace资源，包含按量和包年包月、混合计费
 *
 * @param request ModifyNamespaceSpecV2Request
 * @return ModifyNamespaceSpecV2Response
 */
async function modifyNamespaceSpecV2(request: ModifyNamespaceSpecV2Request): ModifyNamespaceSpecV2Response {
  var runtime = new Util.RuntimeOptions{};
  return modifyNamespaceSpecV2WithOptions(request, runtime);
}

model ModifyPrepayInstanceSpecRequest {
  ha?: boolean(name='Ha', nullable=true),
  haResourceSpec?: {
    cpu?: int32(name='Cpu'),
    memoryGB?: int32(name='MemoryGB'),
  }(name='HaResourceSpec', nullable=true),
  haVSwitchIds?: [ string ](name='HaVSwitchIds', nullable=true),
  haZoneId?: string(name='HaZoneId', nullable=true),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
  resourceSpec?: {
    cpu?: int32(name='Cpu', description='This parameter is required.', example='1'),
    memoryGB?: int32(name='MemoryGB', description='This parameter is required.', example='4'),
  }(name='ResourceSpec', description='This parameter is required.'),
}

model ModifyPrepayInstanceSpecShrinkRequest {
  ha?: boolean(name='Ha', nullable=true),
  haResourceSpecShrink?: string(name='HaResourceSpec', nullable=true),
  haVSwitchIdsShrink?: string(name='HaVSwitchIds', nullable=true),
  haZoneId?: string(name='HaZoneId', nullable=true),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
  resourceSpecShrink?: string(name='ResourceSpec', description='This parameter is required.'),
}

model ModifyPrepayInstanceSpecResponseBody = {
  orderId?: long(name='OrderId', example='210406354690749'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model ModifyPrepayInstanceSpecResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyPrepayInstanceSpecResponseBody(name='body'),
}

/**
 * @deprecated OpenAPI ModifyPrepayInstanceSpec is deprecated, please use foasconsole::2021-10-28::ModifyInstanceSpec instead.
 *
 * @summary 扩容/缩容
 *
 * @param tmpReq ModifyPrepayInstanceSpecRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyPrepayInstanceSpecResponse
 */
// Deprecated
async function modifyPrepayInstanceSpecWithOptions(tmpReq: ModifyPrepayInstanceSpecRequest, runtime: Util.RuntimeOptions): ModifyPrepayInstanceSpecResponse {
  Util.validateModel(tmpReq);
  var request = new ModifyPrepayInstanceSpecShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.haResourceSpec)) {
    request.haResourceSpecShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.haResourceSpec, 'HaResourceSpec', 'json');
  }
  if (!Util.isUnset(tmpReq.haVSwitchIds)) {
    request.haVSwitchIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.haVSwitchIds, 'HaVSwitchIds', 'json');
  }
  if (!Util.isUnset(tmpReq.resourceSpec)) {
    request.resourceSpecShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.resourceSpec, 'ResourceSpec', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.ha)) {
    body['Ha'] = request.ha;
  }
  if (!Util.isUnset(request.haResourceSpecShrink)) {
    body['HaResourceSpec'] = request.haResourceSpecShrink;
  }
  if (!Util.isUnset(request.haVSwitchIdsShrink)) {
    body['HaVSwitchIds'] = request.haVSwitchIdsShrink;
  }
  if (!Util.isUnset(request.haZoneId)) {
    body['HaZoneId'] = request.haZoneId;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceSpecShrink)) {
    body['ResourceSpec'] = request.resourceSpecShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifyPrepayInstanceSpec',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @deprecated OpenAPI ModifyPrepayInstanceSpec is deprecated, please use foasconsole::2021-10-28::ModifyInstanceSpec instead.
 *
 * @summary 扩容/缩容
 *
 * @param request ModifyPrepayInstanceSpecRequest
 * @return ModifyPrepayInstanceSpecResponse
 */
// Deprecated
async function modifyPrepayInstanceSpec(request: ModifyPrepayInstanceSpecRequest): ModifyPrepayInstanceSpecResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyPrepayInstanceSpecWithOptions(request, runtime);
}

model ModifyPrepayNamespaceSpecRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  namespace?: string(name='Namespace', description='This parameter is required.', example='di-593440219799842'),
  region?: string(name='Region', description='This parameter is required.', example='cn-shenzhen'),
  resourceSpec?: {
    cpu?: int32(name='Cpu', description='This parameter is required.', example='1'),
    memoryGB?: int32(name='MemoryGB', description='This parameter is required.', example='4'),
  }(name='ResourceSpec', description='This parameter is required.'),
}

model ModifyPrepayNamespaceSpecShrinkRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  namespace?: string(name='Namespace', description='This parameter is required.', example='di-593440219799842'),
  region?: string(name='Region', description='This parameter is required.', example='cn-shenzhen'),
  resourceSpecShrink?: string(name='ResourceSpec', description='This parameter is required.'),
}

model ModifyPrepayNamespaceSpecResponseBody = {
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model ModifyPrepayNamespaceSpecResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyPrepayNamespaceSpecResponseBody(name='body'),
}

/**
 * @deprecated OpenAPI ModifyPrepayNamespaceSpec is deprecated, please use foasconsole::2021-10-28::ModifyNamespaceSpec instead.
 *
 * @summary 修改namespace资源分配
 *
 * @param tmpReq ModifyPrepayNamespaceSpecRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyPrepayNamespaceSpecResponse
 */
// Deprecated
async function modifyPrepayNamespaceSpecWithOptions(tmpReq: ModifyPrepayNamespaceSpecRequest, runtime: Util.RuntimeOptions): ModifyPrepayNamespaceSpecResponse {
  Util.validateModel(tmpReq);
  var request = new ModifyPrepayNamespaceSpecShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.resourceSpec)) {
    request.resourceSpecShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.resourceSpec, 'ResourceSpec', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.namespace)) {
    body['Namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceSpecShrink)) {
    body['ResourceSpec'] = request.resourceSpecShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifyPrepayNamespaceSpec',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @deprecated OpenAPI ModifyPrepayNamespaceSpec is deprecated, please use foasconsole::2021-10-28::ModifyNamespaceSpec instead.
 *
 * @summary 修改namespace资源分配
 *
 * @param request ModifyPrepayNamespaceSpecRequest
 * @return ModifyPrepayNamespaceSpecResponse
 */
// Deprecated
async function modifyPrepayNamespaceSpec(request: ModifyPrepayNamespaceSpecRequest): ModifyPrepayNamespaceSpecResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyPrepayNamespaceSpecWithOptions(request, runtime);
}

model QueryConvertInstancePriceRequest {
  duration?: int32(name='Duration', description='This parameter is required.', example='1'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  isAutoRenew?: boolean(name='IsAutoRenew', description='This parameter is required.', example='true'),
  namespaceResourceSpecs?: [ 
    {
      namespace?: string(name='Namespace', description='This parameter is required.', example='lm-test-default'),
      resourceSpec?: {
        cpu?: int32(name='Cpu', description='This parameter is required.', example='6'),
        memoryGB?: int32(name='MemoryGB', description='This parameter is required.', example='24'),
      }(name='ResourceSpec', description='This parameter is required.'),
    }
  ](name='NamespaceResourceSpecs', description='This parameter is required.'),
  pricingCycle?: string(name='PricingCycle', description='This parameter is required.', example='Month'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
}

model QueryConvertInstancePriceShrinkRequest {
  duration?: int32(name='Duration', description='This parameter is required.', example='1'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  isAutoRenew?: boolean(name='IsAutoRenew', description='This parameter is required.', example='true'),
  namespaceResourceSpecsShrink?: string(name='NamespaceResourceSpecs', description='This parameter is required.'),
  pricingCycle?: string(name='PricingCycle', description='This parameter is required.', example='Month'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
}

model QueryConvertInstancePriceResponseBody = {
  priceInfo?: {
    code?: string(name='Code', example='ORDER.INST_HAS_UNPAID_ORDER'),
    currency?: string(name='Currency', example='CNY'),
    depreciateInfo?: {
      cheapRate?: string(name='CheapRate'),
      cheapStandAmount?: string(name='CheapStandAmount'),
      isShow?: boolean(name='IsShow'),
      monthPrice?: string(name='MonthPrice'),
      originalStandAmount?: string(name='OriginalStandAmount'),
      startTime?: string(name='StartTime'),
    }(name='DepreciateInfo'),
    discountAmount?: float(name='DiscountAmount', example='655.2'),
    isContractActivity?: boolean(name='IsContractActivity'),
    message?: string(name='Message', example='存在未支付订单，请先支付或取消原有订单'),
    optionalPromotions?: [ 
      {
        promotionDesc?: string(name='PromotionDesc', example='￥1,391.5 优惠券 (有效期至 03/23/2022)'),
        promotionName?: string(name='PromotionName', example='￥1,391.5 优惠券'),
        promotionOptionNo?: string(name='PromotionOptionNo', example='500011220010099'),
        selected?: boolean(name='Selected', example='true'),
      }
    ](name='OptionalPromotions'),
    originalAmount?: float(name='OriginalAmount', example='4368'),
    rules?: [ 
      {
        description?: string(name='Description', example='买满1年，立享官网价格8.5折优惠。'),
        ruleId?: long(name='RuleId', example='587'),
      }
    ](name='Rules'),
    standDiscountPrice?: string(name='StandDiscountPrice'),
    standPrice?: string(name='StandPrice'),
    tradeAmount?: float(name='TradeAmount', example='3712.8'),
  }(name='PriceInfo'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model QueryConvertInstancePriceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryConvertInstancePriceResponseBody(name='body'),
}

/**
 * @summary 按量付费转包年包月询价
 *
 * @param tmpReq QueryConvertInstancePriceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryConvertInstancePriceResponse
 */
async function queryConvertInstancePriceWithOptions(tmpReq: QueryConvertInstancePriceRequest, runtime: Util.RuntimeOptions): QueryConvertInstancePriceResponse {
  Util.validateModel(tmpReq);
  var request = new QueryConvertInstancePriceShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.namespaceResourceSpecs)) {
    request.namespaceResourceSpecsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.namespaceResourceSpecs, 'NamespaceResourceSpecs', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.duration)) {
    body['Duration'] = request.duration;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.isAutoRenew)) {
    body['IsAutoRenew'] = request.isAutoRenew;
  }
  if (!Util.isUnset(request.namespaceResourceSpecsShrink)) {
    body['NamespaceResourceSpecs'] = request.namespaceResourceSpecsShrink;
  }
  if (!Util.isUnset(request.pricingCycle)) {
    body['PricingCycle'] = request.pricingCycle;
  }
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryConvertInstancePrice',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 按量付费转包年包月询价
 *
 * @param request QueryConvertInstancePriceRequest
 * @return QueryConvertInstancePriceResponse
 */
async function queryConvertInstancePrice(request: QueryConvertInstancePriceRequest): QueryConvertInstancePriceResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryConvertInstancePriceWithOptions(request, runtime);
}

model QueryConvertPrepayInstancePriceRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
}

model QueryConvertPrepayInstancePriceResponseBody = {
  priceInfo?: {
    code?: string(name='Code', example='ORDER.INST_HAS_UNPAID_ORDER'),
    currency?: string(name='Currency', example='CNY'),
    depreciateInfo?: {
      cheapRate?: string(name='CheapRate', example='20%'),
      cheapStandAmount?: string(name='CheapStandAmount', example='8000'),
      isShow?: boolean(name='IsShow', example='true'),
      monthPrice?: string(name='MonthPrice', example='4000'),
      originalStandAmount?: string(name='OriginalStandAmount', example='10000'),
      startTime?: string(name='StartTime', example='2023-03-31T16:00:00Z'),
    }(name='DepreciateInfo'),
    discountAmount?: float(name='DiscountAmount', example='655.2'),
    isContractActivity?: boolean(name='IsContractActivity', example='true'),
    message?: string(name='Message', example='存在未支付订单，请先支付或取消原有订单'),
    optionalPromotions?: [ 
      {
        promotionDesc?: string(name='PromotionDesc', example='￥1,391.5 优惠券 (有效期至 03/23/2022)'),
        promotionName?: string(name='PromotionName', example='￥1,391.5 优惠券'),
        promotionOptionNo?: string(name='PromotionOptionNo', example='500011220010099'),
        selected?: boolean(name='Selected', example='true'),
      }
    ](name='OptionalPromotions'),
    originalAmount?: float(name='OriginalAmount', example='4368'),
    rules?: [ 
      {
        description?: string(name='Description', example='买满1年，立享官网价格8.5折优惠。'),
        ruleId?: long(name='RuleId', example='587'),
      }
    ](name='Rules'),
    standDiscountPrice?: string(name='StandDiscountPrice', example='21321'),
    standPrice?: string(name='StandPrice', example='32432'),
    tradeAmount?: float(name='TradeAmount', example='3712.8'),
  }(name='PriceInfo'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model QueryConvertPrepayInstancePriceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryConvertPrepayInstancePriceResponseBody(name='body'),
}

/**
 * @summary 包年包月转按量付费询价
 *
 * @param request QueryConvertPrepayInstancePriceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryConvertPrepayInstancePriceResponse
 */
async function queryConvertPrepayInstancePriceWithOptions(request: QueryConvertPrepayInstancePriceRequest, runtime: Util.RuntimeOptions): QueryConvertPrepayInstancePriceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryConvertPrepayInstancePrice',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 包年包月转按量付费询价
 *
 * @param request QueryConvertPrepayInstancePriceRequest
 * @return QueryConvertPrepayInstancePriceResponse
 */
async function queryConvertPrepayInstancePrice(request: QueryConvertPrepayInstancePriceRequest): QueryConvertPrepayInstancePriceResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryConvertPrepayInstancePriceWithOptions(request, runtime);
}

model QueryCreateInstancePriceRequest {
  architectureType?: string(name='ArchitectureType'),
  autoRenew?: boolean(name='AutoRenew', example='true'),
  chargeType?: string(name='ChargeType', description='This parameter is required.', example='PRE'),
  duration?: int32(name='Duration', example='1'),
  extra?: string(name='Extra'),
  ha?: boolean(name='Ha'),
  haResourceSpec?: {
    cpu?: int32(name='Cpu', nullable=false),
    memoryGB?: int32(name='MemoryGB', nullable=false),
  }(name='HaResourceSpec', nullable=true),
  instanceName?: string(name='InstanceName', example='rtc-e2e-test-post'),
  pricingCycle?: string(name='PricingCycle', example='Month'),
  promotionCode?: string(name='PromotionCode', example='500041860100636'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
  resourceSpec?: {
    cpu?: int32(name='Cpu', example='4'),
    memoryGB?: int32(name='MemoryGB', example='16'),
  }(name='ResourceSpec'),
  storage?: {
    oss?: {
      bucket?: string(name='Bucket', example='quicktracing'),
    }(name='Oss'),
  }(name='Storage'),
  usePromotionCode?: boolean(name='UsePromotionCode'),
  vSwitchIds?: [ string ](name='VSwitchIds'),
  vpcId?: string(name='VpcId', example='vpc-2ze9xoh8qyt1rnxfmfcdi'),
}

model QueryCreateInstancePriceShrinkRequest {
  architectureType?: string(name='ArchitectureType'),
  autoRenew?: boolean(name='AutoRenew', example='true'),
  chargeType?: string(name='ChargeType', description='This parameter is required.', example='PRE'),
  duration?: int32(name='Duration', example='1'),
  extra?: string(name='Extra'),
  ha?: boolean(name='Ha'),
  haResourceSpecShrink?: string(name='HaResourceSpec', nullable=true),
  instanceName?: string(name='InstanceName', example='rtc-e2e-test-post'),
  pricingCycle?: string(name='PricingCycle', example='Month'),
  promotionCode?: string(name='PromotionCode', example='500041860100636'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
  resourceSpecShrink?: string(name='ResourceSpec'),
  storageShrink?: string(name='Storage'),
  usePromotionCode?: boolean(name='UsePromotionCode'),
  vSwitchIdsShrink?: string(name='VSwitchIds'),
  vpcId?: string(name='VpcId', example='vpc-2ze9xoh8qyt1rnxfmfcdi'),
}

model QueryCreateInstancePriceResponseBody = {
  priceInfo?: {
    code?: string(name='Code', example='ORDER.INST_HAS_UNPAID_ORDER'),
    currency?: string(name='Currency', example='CNY'),
    depreciateInfo?: {
      cheapRate?: string(name='CheapRate'),
      cheapStandAmount?: string(name='CheapStandAmount'),
      isShow?: boolean(name='IsShow'),
      monthPrice?: string(name='MonthPrice'),
      originalStandAmount?: string(name='OriginalStandAmount'),
      startTime?: string(name='StartTime'),
    }(name='DepreciateInfo'),
    discountAmount?: float(name='DiscountAmount', example='655.2'),
    isContractActivity?: boolean(name='IsContractActivity'),
    message?: string(name='Message', example='存在未支付订单，请先支付或取消原有订单'),
    optionalPromotions?: [ 
      {
        promotionDesc?: string(name='PromotionDesc', example='￥1,391.5 优惠券 (有效期至 03/23/2022)'),
        promotionName?: string(name='PromotionName', example='￥1,391.5 优惠券'),
        promotionOptionNo?: string(name='PromotionOptionNo', example='500011220010099'),
        selected?: boolean(name='Selected', example='true'),
      }
    ](name='OptionalPromotions'),
    originalAmount?: float(name='OriginalAmount', example='4368'),
    rules?: [ 
      {
        description?: string(name='Description', example='买满1年，立享官网价格8.5折优惠。'),
        ruleId?: long(name='RuleId', example='587'),
      }
    ](name='Rules'),
    standDiscountPrice?: string(name='StandDiscountPrice'),
    standPrice?: string(name='StandPrice'),
    tradeAmount?: float(name='TradeAmount', example='3712.8'),
  }(name='PriceInfo'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success'),
}

model QueryCreateInstancePriceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryCreateInstancePriceResponseBody(name='body'),
}

/**
 * @summary 获取创建实例的价格
 *
 * @param tmpReq QueryCreateInstancePriceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryCreateInstancePriceResponse
 */
async function queryCreateInstancePriceWithOptions(tmpReq: QueryCreateInstancePriceRequest, runtime: Util.RuntimeOptions): QueryCreateInstancePriceResponse {
  Util.validateModel(tmpReq);
  var request = new QueryCreateInstancePriceShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.haResourceSpec)) {
    request.haResourceSpecShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.haResourceSpec, 'HaResourceSpec', 'json');
  }
  if (!Util.isUnset(tmpReq.resourceSpec)) {
    request.resourceSpecShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.resourceSpec, 'ResourceSpec', 'json');
  }
  if (!Util.isUnset(tmpReq.storage)) {
    request.storageShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.storage, 'Storage', 'json');
  }
  if (!Util.isUnset(tmpReq.vSwitchIds)) {
    request.vSwitchIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.vSwitchIds, 'VSwitchIds', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.architectureType)) {
    body['ArchitectureType'] = request.architectureType;
  }
  if (!Util.isUnset(request.autoRenew)) {
    body['AutoRenew'] = request.autoRenew;
  }
  if (!Util.isUnset(request.chargeType)) {
    body['ChargeType'] = request.chargeType;
  }
  if (!Util.isUnset(request.duration)) {
    body['Duration'] = request.duration;
  }
  if (!Util.isUnset(request.extra)) {
    body['Extra'] = request.extra;
  }
  if (!Util.isUnset(request.ha)) {
    body['Ha'] = request.ha;
  }
  if (!Util.isUnset(request.haResourceSpecShrink)) {
    body['HaResourceSpec'] = request.haResourceSpecShrink;
  }
  if (!Util.isUnset(request.instanceName)) {
    body['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.pricingCycle)) {
    body['PricingCycle'] = request.pricingCycle;
  }
  if (!Util.isUnset(request.promotionCode)) {
    body['PromotionCode'] = request.promotionCode;
  }
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceSpecShrink)) {
    body['ResourceSpec'] = request.resourceSpecShrink;
  }
  if (!Util.isUnset(request.storageShrink)) {
    body['Storage'] = request.storageShrink;
  }
  if (!Util.isUnset(request.usePromotionCode)) {
    body['UsePromotionCode'] = request.usePromotionCode;
  }
  if (!Util.isUnset(request.vSwitchIdsShrink)) {
    body['VSwitchIds'] = request.vSwitchIdsShrink;
  }
  if (!Util.isUnset(request.vpcId)) {
    body['VpcId'] = request.vpcId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryCreateInstancePrice',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取创建实例的价格
 *
 * @param request QueryCreateInstancePriceRequest
 * @return QueryCreateInstancePriceResponse
 */
async function queryCreateInstancePrice(request: QueryCreateInstancePriceRequest): QueryCreateInstancePriceResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryCreateInstancePriceWithOptions(request, runtime);
}

model QueryModifyInstancePriceRequest {
  ha?: boolean(name='Ha'),
  haResourceSpec?: {
    cpu?: int32(name='Cpu'),
    memoryGB?: int32(name='MemoryGB'),
  }(name='HaResourceSpec', nullable=true),
  haVSwitchIds?: [ string ](name='HaVSwitchIds', nullable=true),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  promotionCode?: string(name='PromotionCode'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
  resourceSpec?: {
    cpu?: int32(name='Cpu', description='This parameter is required.', example='10'),
    memoryGB?: int32(name='MemoryGB', description='This parameter is required.', example='40'),
  }(name='ResourceSpec', description='This parameter is required.'),
  usePromotionCode?: boolean(name='UsePromotionCode'),
}

model QueryModifyInstancePriceShrinkRequest {
  ha?: boolean(name='Ha'),
  haResourceSpecShrink?: string(name='HaResourceSpec', nullable=true),
  haVSwitchIdsShrink?: string(name='HaVSwitchIds', nullable=true),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='f-cn-wwo36qj4g06'),
  promotionCode?: string(name='PromotionCode'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
  resourceSpecShrink?: string(name='ResourceSpec', description='This parameter is required.'),
  usePromotionCode?: boolean(name='UsePromotionCode'),
}

model QueryModifyInstancePriceResponseBody = {
  priceInfo?: {
    code?: string(name='Code', example='ORDER.INST_HAS_UNPAID_ORDER'),
    currency?: string(name='Currency', example='CNY'),
    depreciateInfo?: {
      cheapRate?: string(name='CheapRate'),
      cheapStandAmount?: string(name='CheapStandAmount'),
      isShow?: boolean(name='IsShow'),
      monthPrice?: string(name='MonthPrice'),
      originalStandAmount?: string(name='OriginalStandAmount'),
      startTime?: string(name='StartTime'),
    }(name='DepreciateInfo'),
    discountAmount?: float(name='DiscountAmount', example='655.2'),
    isContractActivity?: boolean(name='IsContractActivity'),
    message?: string(name='Message', example='存在未支付订单，请先支付或取消原有订单'),
    optionalPromotions?: [ 
      {
        promotionDesc?: string(name='PromotionDesc', example='￥1,391.5 优惠券 (有效期至 03/23/2022)'),
        promotionName?: string(name='PromotionName', example='￥1,391.5 优惠券'),
        promotionOptionNo?: string(name='PromotionOptionNo', example='500011220010099'),
        selected?: boolean(name='Selected', example='true'),
      }
    ](name='OptionalPromotions'),
    originalAmount?: float(name='OriginalAmount', example='4368'),
    rules?: [ 
      {
        description?: string(name='Description', example='买满1年，立享官网价格8.5折优惠。'),
        ruleId?: long(name='RuleId', example='587'),
      }
    ](name='Rules'),
    standDiscountPrice?: string(name='StandDiscountPrice'),
    standPrice?: string(name='StandPrice'),
    tradeAmount?: float(name='TradeAmount', example='3712.8'),
  }(name='PriceInfo'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model QueryModifyInstancePriceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryModifyInstancePriceResponseBody(name='body'),
}

/**
 * @summary 查询付费类型为包年包月的实例修改资源规格的价格
 *
 * @param tmpReq QueryModifyInstancePriceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryModifyInstancePriceResponse
 */
async function queryModifyInstancePriceWithOptions(tmpReq: QueryModifyInstancePriceRequest, runtime: Util.RuntimeOptions): QueryModifyInstancePriceResponse {
  Util.validateModel(tmpReq);
  var request = new QueryModifyInstancePriceShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.haResourceSpec)) {
    request.haResourceSpecShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.haResourceSpec, 'HaResourceSpec', 'json');
  }
  if (!Util.isUnset(tmpReq.haVSwitchIds)) {
    request.haVSwitchIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.haVSwitchIds, 'HaVSwitchIds', 'json');
  }
  if (!Util.isUnset(tmpReq.resourceSpec)) {
    request.resourceSpecShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.resourceSpec, 'ResourceSpec', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.ha)) {
    body['Ha'] = request.ha;
  }
  if (!Util.isUnset(request.haResourceSpecShrink)) {
    body['HaResourceSpec'] = request.haResourceSpecShrink;
  }
  if (!Util.isUnset(request.haVSwitchIdsShrink)) {
    body['HaVSwitchIds'] = request.haVSwitchIdsShrink;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.promotionCode)) {
    body['PromotionCode'] = request.promotionCode;
  }
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceSpecShrink)) {
    body['ResourceSpec'] = request.resourceSpecShrink;
  }
  if (!Util.isUnset(request.usePromotionCode)) {
    body['UsePromotionCode'] = request.usePromotionCode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryModifyInstancePrice',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询付费类型为包年包月的实例修改资源规格的价格
 *
 * @param request QueryModifyInstancePriceRequest
 * @return QueryModifyInstancePriceResponse
 */
async function queryModifyInstancePrice(request: QueryModifyInstancePriceRequest): QueryModifyInstancePriceResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryModifyInstancePriceWithOptions(request, runtime);
}

model QueryRenewInstancePriceRequest {
  duration?: int32(name='Duration', description='This parameter is required.', example='1'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='sc_flinkserverless_public_cn-7e22ae5sess'),
  pricingCycle?: string(name='PricingCycle', description='This parameter is required.', example='Month'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
}

model QueryRenewInstancePriceResponseBody = {
  priceInfo?: {
    code?: string(name='Code', example='ORDER.INST_HAS_UNPAID_ORDER'),
    currency?: string(name='Currency', example='CNY'),
    depreciateInfo?: {
      cheapRate?: string(name='CheapRate'),
      cheapStandAmount?: string(name='CheapStandAmount'),
      isShow?: boolean(name='IsShow'),
      monthPrice?: string(name='MonthPrice'),
      originalStandAmount?: string(name='OriginalStandAmount'),
      startTime?: string(name='StartTime'),
    }(name='DepreciateInfo'),
    discountAmount?: float(name='DiscountAmount', example='655.2'),
    isContractActivity?: boolean(name='IsContractActivity'),
    message?: string(name='Message', example='存在未支付订单，请先支付或取消原有订单'),
    optionalPromotions?: [ 
      {
        promotionDesc?: string(name='PromotionDesc', example='￥1,391.5 优惠券 (有效期至 03/23/2022)'),
        promotionName?: string(name='PromotionName', example='￥1,391.5 优惠券'),
        promotionOptionNo?: string(name='PromotionOptionNo', example='500011220010099'),
        selected?: boolean(name='Selected', example='true'),
      }
    ](name='OptionalPromotions'),
    originalAmount?: float(name='OriginalAmount', example='4368'),
    rules?: [ 
      {
        description?: string(name='Description', example='买满1年，立享官网价格8.5折优惠。'),
        ruleId?: long(name='RuleId', example='587'),
      }
    ](name='Rules'),
    standDiscountPrice?: string(name='StandDiscountPrice'),
    standPrice?: string(name='StandPrice'),
    tradeAmount?: float(name='TradeAmount', example='3712.8'),
  }(name='PriceInfo'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model QueryRenewInstancePriceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryRenewInstancePriceResponseBody(name='body'),
}

/**
 * @summary 查询付费类型为包年包月的实例续费价格
 *
 * @param request QueryRenewInstancePriceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryRenewInstancePriceResponse
 */
async function queryRenewInstancePriceWithOptions(request: QueryRenewInstancePriceRequest, runtime: Util.RuntimeOptions): QueryRenewInstancePriceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.duration)) {
    body['Duration'] = request.duration;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pricingCycle)) {
    body['PricingCycle'] = request.pricingCycle;
  }
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryRenewInstancePrice',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询付费类型为包年包月的实例续费价格
 *
 * @param request QueryRenewInstancePriceRequest
 * @return QueryRenewInstancePriceResponse
 */
async function queryRenewInstancePrice(request: QueryRenewInstancePriceRequest): QueryRenewInstancePriceResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryRenewInstancePriceWithOptions(request, runtime);
}

model RenewInstanceRequest {
  duration?: int32(name='Duration', description='This parameter is required.', example='1'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='sc_flinkserverless_public_cn-7e22ae5sess'),
  pricingCycle?: string(name='PricingCycle', description='This parameter is required.', example='Month'),
  region?: string(name='Region', description='This parameter is required.', example='cn-beijing'),
}

model RenewInstanceResponseBody = {
  orderId?: long(name='OrderId', description='orderId', example='210406354690749'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model RenewInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RenewInstanceResponseBody(name='body'),
}

/**
 * @summary 续费
 *
 * @param request RenewInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RenewInstanceResponse
 */
async function renewInstanceWithOptions(request: RenewInstanceRequest, runtime: Util.RuntimeOptions): RenewInstanceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.duration)) {
    body['Duration'] = request.duration;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pricingCycle)) {
    body['PricingCycle'] = request.pricingCycle;
  }
  if (!Util.isUnset(request.region)) {
    body['Region'] = request.region;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RenewInstance',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 续费
 *
 * @param request RenewInstanceRequest
 * @return RenewInstanceResponse
 */
async function renewInstance(request: RenewInstanceRequest): RenewInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return renewInstanceWithOptions(request, runtime);
}

model TagResourcesRequest {
  regionId?: string(name='RegionId', description='This parameter is required.', example='cn-beijing'),
  resourceId?: [ string ](name='ResourceId', description='This parameter is required.'),
  resourceType?: string(name='ResourceType', description='This parameter is required.', example='vvpinstance'),
  tag?: [ 
    {
      key?: string(name='Key', example='test'),
      value?: string(name='Value', example='tag'),
    }
  ](name='Tag', description='This parameter is required.'),
}

model TagResourcesResponseBody = {
  code?: string(name='Code', example='200'),
  message?: string(name='Message', example='""'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
  tagResponseId?: string(name='TagResponseId', example='154FT'),
}

model TagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: TagResourcesResponseBody(name='body'),
}

/**
 * @summary 打标签接口
 *
 * @param request TagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return TagResourcesResponse
 */
async function tagResourcesWithOptions(request: TagResourcesRequest, runtime: Util.RuntimeOptions): TagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'TagResources',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 打标签接口
 *
 * @param request TagResourcesRequest
 * @return TagResourcesResponse
 */
async function tagResources(request: TagResourcesRequest): TagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return tagResourcesWithOptions(request, runtime);
}

model UntagResourcesRequest {
  all?: boolean(name='All', example='false'),
  regionId?: string(name='RegionId', description='This parameter is required.', example='cn-beijing'),
  resourceId?: [ string ](name='ResourceId', description='This parameter is required.'),
  resourceType?: string(name='ResourceType', description='This parameter is required.', example='vvpinstance'),
  tagKey?: [ string ](name='TagKey'),
}

model UntagResourcesResponseBody = {
  code?: string(name='Code', example='200'),
  message?: string(name='Message', example='""'),
  requestId?: string(name='RequestId', example='F59597FC-CD05-536D-B75B-6F45B8CC8539'),
  success?: boolean(name='Success', example='true'),
  tagResponseId?: string(name='TagResponseId', example='154FT'),
}

model UntagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UntagResourcesResponseBody(name='body'),
}

/**
 * @summary flinkasi去标签
 *
 * @param request UntagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UntagResourcesResponse
 */
async function untagResourcesWithOptions(request: UntagResourcesRequest, runtime: Util.RuntimeOptions): UntagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.all)) {
    query['All'] = request.all;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tagKey)) {
    query['TagKey'] = request.tagKey;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UntagResources',
    version = '2021-10-28',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary flinkasi去标签
 *
 * @param request UntagResourcesRequest
 * @return UntagResourcesResponse
 */
async function untagResources(request: UntagResourcesRequest): UntagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return untagResourcesWithOptions(request, runtime);
}

